  
<cfcomponent displayname="libAccess" hint="I model a single libAccess.">

	<cfset variables.NumericNull = 0 />
	<cfset variables.StringNull = "" />
	<cfset variables.DateNull = now() />
	<cfset variables.BinaryNull = toBinary(toBase64("null")) />
		
	<cffunction name="init" access="public" returntype="libAccess" output="false" displayname="libAccess Constructor" hint="I initialize a libAccess.">
	<cfargument name="userid" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="libID" type="string" required="false" default="#variables.stringNull#"/>
	

		<cfscript>
			variables.instanceData = structnew();
			
			setuserid(arguments.userid);
			setlibID(arguments.libID);
		</cfscript>

		<cfreturn this />
	</cffunction>

	<cffunction name="setInstanceData" access="public" output="false" returntype="void">
		<cfargument name="data" type="struct" required="true"/>
		<cfset variables.instanceData = arguments.data/>
	</cffunction>

	<cffunction name="getInstanceData" access="public" output="false" returntype="struct">

		<cfreturn variables.instanceData/>
	</cffunction>
	
	<cffunction name="hasId" access="public" output="false" returntype="boolean" hint="I retrieve whether the libAccess has an id (false indicates it's a new user)">

		<cfreturn structKeyExists(variables.instanceData,"userid")/>
	</cffunction>

	
	<cffunction name="getuserid" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.userid />
	</cffunction>	

	<cffunction name="setuserid" access="public" returntype="void" output="false">
		<cfargument name="userid" type="string" required="true">
		<cfset variables.instanceData.userid=arguments.userid />
	</cffunction>
	
	<cffunction name="getlibID" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.libID />
	</cffunction>	

	<cffunction name="setlibID" access="public" returntype="void" output="false">
		<cfargument name="libID" type="string" required="true">
		<cfset variables.instanceData.libID=arguments.libID />
	</cffunction>
	
</cfcomponent>
	

